package com.junqson.je.content.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 * @Descriptions 帖子模型，按照更新时间排序，暂时不做置顶、附件、点赞等功能
 * @Company
 * @Author Junqson
 * @Date 2020/2/10 23:07
 * @Version 1.0
 */
@Data
@Entity
public class PostModel {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long postId;

    @Column(nullable = false)
    private String title;

    private Integer userId;

//    /**
//     * 附件list json
//     */
//    private String attachments;

    /**
     * 讨论区板块
     */
    @Column(nullable = false)
    private String section;

//    /**
//     * 置顶
//     */
//    private boolean top;

    @CreationTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date postTime;

    @UpdateTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

}
